<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="">
<meta name="robots" content="all,follow">

    <title>Bootstrap Admin Template </title>
    <link rel="shortcut icon" href="${ctx}/static/img/favicon.ico">
    
    <!-- global stylesheets -->
    <link href="https://fonts.googleapis.com/css?family=Roboto+Condensed" rel="stylesheet">
    <link rel="stylesheet" href="${ctx}/static/css/bootstrap.min.css">
    <link rel="stylesheet" href="${ctx}/static/font-awesome-4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="${ctx}/static/css/font-icon-style.css">
    <link rel="stylesheet" href="${ctx}/static/css/style.default.css" id="theme-stylesheet">

    <!-- Core stylesheets -->
    <link rel="stylesheet" href="css/form.css">
    <style>
    	.row{
    		margin-left: 0;
    		margin-right: 0;
    	}
    </style>
</head>

<body>
    
<!--====================================================
                     MAIN NAVBAR
======================================================-->
<jsp:include page="../header.jsp" />
<!--====================================================
                    PAGE CONTENT
======================================================-->
    <div class="page-content d-flex align-items-stretch">
       
        <!--***** SIDE NAVBAR *****-->
        <jsp:include page="../left.jsp" />
		<jsp:include page="../alertMsg.jsp" />

        <div class="content-inner form-cont">
            <div class="row">
                <div class="col-md-12">

                    <!--***** BASIC FORM *****-->
                    <div class="card form" id="form1">
                        <div class="card-header">
                            <h3>人员添加</h3>
                        </div>
                        <br>
                        <form action="${ctx}/managerUser/saveOrUpdate">
                        	<input type="hidden" name="id" value="${managerUser.id }">
                            <div class="card form container">
                            	<div class="row">
		                            <div class="col-md-6">
		                                <div class="form-group row">
		                                    <label for="example-text-input" style="width: 85px;" class=" col-form-label">登录名</label>
		                                    <div class="col-9">
		                                        <input class="form-control" type="text" value="${managerUser.loginUser }" name="loginUser" id="loginUser">
		                                    </div>
		                                </div>
		                                <div class="form-group row">
		                                    <label for="example-password-input" style="width: 85px;" class=" col-form-label">密码</label>
		                                    <div class="col-9">
		                                        <input class="form-control" type="password" value="${managerUser.password }" name="password" id="password">
		                                    </div>
		                                </div>
		                                <div class="form-group row">
		                                    <label for="example-tel-input" style="width: 85px;" class=" col-form-label">电话</label>
		                                    <div class="col-9">
		                                        <input class="form-control" type="tel" value="${managerUser.phone }" name="phone" id="phone">
		                                    </div>
		                                </div>
		                                <div class="form-group row">
		                                    <label for="example-text-input" style="width: 85px;" class=" col-form-label">工号</label>
		                                    <div class="col-9">
		                                        <input class="form-control" type="text" value="${managerUser.workNumber }" name="workNumber" id="workNumber" maxlength="8">
		                                    </div>
		                                </div>
		                            </div>
		                            <div class="col-md-6">
		                                <div class="form-group row">
		                                    <label for="example-text-input" style="width: 85px;" class=" col-form-label">真实姓名</label>
		                                    <div class="col-9">
		                                        <input class="form-control" type="text" value="${managerUser.name }" name="name" id="name" maxlength="255">
		                                    </div>
		                                </div>
		                                <div class="form-group row">
		                                    <label for="example-text-input" style="width: 85px;" class=" col-form-label">性别</label>
		                                    <div class="col-9">
		                                    	<select class="form-control" id="sex" name="sex">
		                                            <option <c:if test="${managerUser.sex == 0 }">selected="selected"</c:if> value="0">男</option>
		                                            <option <c:if test="${managerUser.sex == 1 }">selected="selected"</c:if> value="1">女</option>
		                                        </select>
		                                    </div>
		                                </div>
		                                <div class="form-group row">
		                                    <label for="example-text-input" style="width: 85px;" class=" col-form-label">地址</label>
		                                    <div class="col-9">
		                                        <input class="form-control" type="text" value="${managerUser.address }" name="address" id="address" maxlength="255">
		                                    </div>
		                                </div>
		                                <div class="form-group row">
		                                    <label for="example-text-input" style="width: 85px;" class=" col-form-label">管理员类型</label>
		                                    <div class="col-9">
		                                    	<select class="form-control" id="managementtype" name="managementtype">
		                                            <option value="-1">请选择...</option>
		                                            <option <c:if test="${managerUser.managementtype == 0 }">selected="selected"</c:if> value="0">超级管理员</option>
		                                            <option <c:if test="${managerUser.managementtype == 1 }">selected="selected"</c:if> value="1">借/还书管理员</option>
		                                            <option <c:if test="${managerUser.managementtype == 2 }">selected="selected"</c:if> value="2">仓库管理员</option>
		                                        </select>
		                                    </div>
		                                </div>
		                            </div>
		                        </div>
                            </div>
                            <div style="text-align:center;margin-bottom: 20px;">
                            	<button type="submit" onclick="return checkData()" class="btn btn-general btn-blue mr-2">Submit</button>  
                            	<button type="reset" class="btn btn-general btn-white">Cancel</button>
                            </div>
                        
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!--Global Javascript -->
    <script src="${ctx}/static/js/jquery.min.js"></script>
    <script src="${ctx}/static/js/popper/popper.min.js"></script>
    <script src="${ctx}/static/js/tether.min.js"></script>
    <script src="${ctx}/static/js/bootstrap.min.js"></script>
    <script src="${ctx}/static/js/jquery.cookie.js"></script>
    <script src="${ctx}/static/js/jquery.validate.min.js"></script> 
    <script src="${ctx}/static/js/chart.min.js"></script> 
    <script src="${ctx}/static/js/front.js"></script> 
    
    <!--Core Javascript -->
    <script type="text/javascript">
    function checkData(){
 	   if($("#loginUser").val() == '' || $("#loginUser").val() == null){
 		   alertMsg("登录名不能为空！", "warning");
 		   return false;
 	   }
 	   
 	   if($("#password").val() == '' || $("#password").val() == null){
 		   alertMsg("密码不能为空！", "warning");
 		   return false;
 	   }
 	   
 	   if($("#name").val() == '' || $("#name").val() == null){
 		   alertMsg("姓名不能为空！", "warning");
 		   return false;
 	   }
 	   
 	   if($("#phone").val() == '' || $("#phone").val() == null){
 		   alertMsg("电话不能为空！", "warning");
 		   return false;
 	   }
 	   
    }
    </script>
</body>

</html>